const webpackApiMocker = require('mocker-api')
const path = require('path')
module.exports = {
  // 代理配置
  devServer: {
    open: true,
    hotOnly: true,
    proxy: {
      '/api/v1/fe/': {
        target: 'http://localhost:7001',
        changeOrigin: true,
      },
      // 注释原因：运行时报错 TypeError: Cannot read property ‘upgrade‘ of undefined
      // 查资料发现排查有引用的变量 VUE_APP_BASE_URL 可能未在.env或.env.development等环境变量定义文件中定义
      // '/survey/': {
      //   target: process.env.VUE_APP_BASE_URL,
      //   secure: false,
      //   changeOrigin: true,
      //   ws: true
      // },
      '/consultant/': {
        // target: 'http://192.168.3.1111:20002',
        target: 'http://questionnaire.client.yun.kapboo.com',
        changeOrigin: true,
        //   pathRewrite: {}
      },

    },
    before(app) {
      webpackApiMocker(app, path.resolve('./mock/index.js'))
    }
  },
  // 2021/07/05 oyd 解决vue antd按需加载报错
  // 参考: https://blog.csdn.net/lhz_333/article/details/116750568
  css: {
    loaderOptions: {
      less: {
        javascriptEnabled: true,
      }
    },
  },
}
